<?php
	function __construct(){
		require './model/goods_model.php';
		$_GET['a']();
	}
	//---------------------------------------
	function index(){
		
		if(isset($_GET['search'])){
			$_POST['search'] = $_GET['search'];
		}
		if(isset($_POST['search'])){
			$_GET['tblname'] = 'shop_goods';
			$_GET['pk'] = 'gid';
			$goods = select(" WHERE gname like '%$_POST[search]%'");
		}else{
			$goods = getgoods();
		}
		require './view/goods/index.php';
	}
	function detail(){
		$good = select(" WHERE gid=$_GET[gid]")[0];
		$_POST['vcnt']=$good['vcnt']+1;
		$_GET['id'] = $_GET['gid'];
		update();
		require './view/goods/detail.php';
	}